package com.scsj.supermarket.view.fragment.myordermodel;


import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.scsj.supermarket.R;
import com.scsj.supermarket.adapter.RecommendForYouAdapter;
import com.scsj.supermarket.bean.RecommendBean;
import com.scsj.supermarket.view.fragment.basemodel.BaseFragment;
import java.util.ArrayList;
import java.util.List;

/**
 * 为你推荐
 */
public class RecommendForYouFragment extends BaseFragment {


    private List<RecommendBean> recommendBeans;
    private RecommendForYouAdapter adapter;
    private RecyclerView recommend_rv;


    @Override
    protected void initView(View view, Bundle savedInstanceState) {
        recommend_rv = view.findViewById(R.id.recommend_rv);
        recommend_rv.setLayoutManager(new GridLayoutManager(getHoldingActivity(), 2));
        recommend_rv.setNestedScrollingEnabled(false);
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {

        recommendBeans = new ArrayList<>();
        recommendBeans.add(new RecommendBean(R.mipmap.zzz_goods_list, "ThinkPad New S2（20GU0000 CD）13.3英寸轻薄笔记本电脑轻薄笔记本电脑轻薄笔记本电脑", "¥4654", 0));
        recommendBeans.add(new RecommendBean(R.mipmap.zzz_goods_list, "ThinkPad New S2（20GU0000 CD）13.3英寸轻薄笔记本电脑轻薄笔记本电脑轻薄笔记本电脑", "¥4654", 0));
        recommendBeans.add(new RecommendBean(R.mipmap.zzz_goods_list, "ThinkPad New S2（20GU0000 CD）13.3英寸轻薄笔记本电脑轻薄笔记本电脑轻薄笔记本电脑", "¥4654", 0));
        recommendBeans.add(new RecommendBean(R.mipmap.zzz_goods_list, "ThinkPad New S2（20GU0000 CD）13.3英寸轻薄笔记本电脑轻薄笔记本电脑轻薄笔记本电脑", "¥4654", 0));
        recommendBeans.add(new RecommendBean(R.mipmap.zzz_goods_list, "ThinkPad New S2（20GU0000 CD）13.3英寸轻薄笔记本电脑轻薄笔记本电脑轻薄笔记本电脑", "¥4654", 0));
        recommendBeans.add(new RecommendBean(R.mipmap.zzz_goods_list, "ThinkPad New S2（20GU0000 CD）13.3英寸轻薄笔记本电脑轻薄笔记本电脑轻薄笔记本电脑", "¥4654", 0));

        adapter = new RecommendForYouAdapter(recommendBeans);
        recommend_rv.setAdapter(adapter);


    }

    @Override
    protected int getLayoutId() {
        return 0;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_recommend_for_you, null);

        initView(view, null);
        initListener();
        initData();

        return view;
    }

}
